import ajax from '@/utils/request'
import { concatUrl } from '@/utils'
import './types'

export function getRedPacketData(data?: GetRedPacketData, fields: string | object = { fields: '*' }) {
    return ajax({
        // url: concatUrl(`/v1/red-packet-user-data/data`, fields),
				url: concatUrl(`/v2/redPacket/red-packet-user-data/data`, fields),
        data
    })
}

export function getRedPacketDetails(data: GetRedPacketDetails = {
    type: 1
}, fields: string | object = { fields: '*,belongType,canUsedAreaLabel' }) {
    return ajax({
        // url: concatUrl(`/v1/red-packet-item/index`, fields),
				url: concatUrl(`/v2/redPacket/red-packet-item/index`, fields),
        data
    })
}

// 使用记录列表
export function getRedPacketLog(data?, fields: string | object = { fields: '*' }) {
    return ajax({
        url: concatUrl(`/v1/red-packet-use-log/index`, fields),
        data
    })
}

// 获取保呗红包
export function getBaobeiData(data?: GetRedPacketData, fields: string | object = { fields: '*' }) {
  return ajax({
    url: concatUrl(`/v1/red-packet-user-data/baobei-data`, fields),
    data
  })
}
// 获取保呗列表
export function getBaobeiDetails(data: GetRedPacketDetails = {
  type: 1
}, fields: string | object = { fields: '*' }) {
  return ajax({
    url: concatUrl(`/v1/red-packet-item/baobei-index`, fields),
    data
  })
}
